API Docs for: 0.0.1
Show:

jsaEvenPhasor (Function) Class

Methods

(jsaEvenPhasor)

()

Creates a phasor used to periodically trigger events

Returns:

Interface object for controlling the eventPhasor containing all the other methods in this module.

advance

(
  • interval
)
Number

Advance the time rotating the phasor accorording to its frequency.

Parameters:

  • interval Number

    of time to advance

Returns:

Number:

current phase

advanceToTick

()

Advances the time to that of next zero phase (which is when it "ticks")

advanceToTime

(
  • The
)
Number

Set the time of the phasor rotating if from its current position as necessary

Parameters:

  • The Number

    time to advance the phasor to.

Returns:

Number:

current phase

getPhase

(
  • phase
)

Get the current phse

Parameters:

  • phase Number

    in [0,1]

nextTickTime

() Number

Advances the time to that of next zero phase (which is when it "ticks")

Returns:

Number:

time in sseconds

setCurrentTime

(
  • time
)

Sets the time

Parameters:

  • time Number

    (in secs)

setFreq

()

Sets the frequency that the phase will move (revolutions per second)

setPhase

(
  • phase
)

Sets the phaser to a specific phase

Parameters:

  • phase Number

    in [0,1]

timeToTick

() Number

Get the time between now and the next tick

Returns:

Number:

the amount of time until next tick